Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure cli file hyperlinks for R package dev tasks #5850

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jennybc
Copy link
Member

@jennybc jennybc commented Dec 21, 2024

Addresses #5409

Needed to wait for r-lib/cli#744, which is now merged

QA Notes

Pre-requisite: You need to install a very recent version of the cli package. At the time I write this, this means a dev version of cli, although I think we'll get a release out fairly soon. In the meantime, a good way to install is:

pak::pak("r-lib/cli")

Make sure the cli version is >= 3.6.3.9002:

packageVersion("cli")
#> [1] '3.6.3.9002'

There won't be any obvious error in the presence of an older cli version, but the new functionality just won't activate.

Then you need to run tests on a package with one or more failing tests, in order to be able to click on the filepath when test failure is reported. This should take you directly to the relevant test location.

I have made a toy package that could be obtained via usethis::create_from_github("jennybc/clilinks"). It has a couple of snapshot tests that will always fail 😄 because they attempt to snapshot a random number. But really any package with a failing test will do.

  • Install dev cli: pak::pak("r-lib/cli")
  • Identify a package with a failing test and open it in Positron, perhaps via: usethis::create_from_github("jennybc/clilinks")
  • Use our gesture for running package tests: Ctrl/Cmd + Shift + T or select R: Test R Package from the command palette.
  • Click on a file hyperlink for a failing test:
    • Note this requires Ctrl/Cmd click! This is a VS Code convention, not specific to us.
    • Note that you might have to click twice. This is a bug (or 2 bugs?) for which fixes are making their way through the system (Sometimes links don't work the first time you click microsoft/vscode#230010). Again, not us.
    • You might need to grant permission to open the file hyperlink. I think I have long since checked some box always permitting this for local files. This is a VS Code feature.
file-hyperlink

Note that this PR removes the feature flag introduced in #5231, since now all hyperlinks work (if the cli version is recent enough). If you configured positron://settings/positron.r.taskHyperlinks in the interim, that setting can be removed and, indeed, no longer exists.

Copy link

github-actions bot commented Dec 21, 2024

E2E Tests 🚀  ?
This PR will run tests tagged with: @critical

@jennybc jennybc force-pushed the configure-r-cli-file-hyperlinks branch from e0c3be7 to 6ea7a38 Compare January 10, 2025 21:48
@jennybc jennybc marked this pull request as ready for review January 10, 2025 21:57
@jennybc jennybc requested a review from juliasilge January 10, 2025 22:13
Copy link
Contributor

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well for me!

Just to document a bit here, there are quite a few popups that folks will need to accept to get this to work:

Screenshot 2025-01-13 at 8 41 36 AM

Copy link
Contributor

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah actually, I've got one more request. Can you add the tag for R package tests to this PR, to run those specific tests? More info at:

https://github.com/posit-dev/positron/blob/main/test/e2e/README.md#pull-requests-and-test-tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants